package com.slipper.system.affix.controller;

import com.slipper.system.affix.bo.AffixItemBO;
import com.slipper.system.affix.service.AffixItemService;
import com.slipper.util.*;
import jakarta.annotation.Resource;

import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/affix")
public class AffixController {
    @Resource
    private AffixItemService affixItemService;

    @PostMapping(value = "/queryItems")
    public String queryItems(@RequestBody AffixItemBO bo) {
        return ResultUtil.successResult(this.affixItemService.queryList(bo));
    }

    @PostMapping(value = "/deleteItem")
    public String deleteItem(@RequestBody AffixItemBO bo) {
        if (Tool.isBlank(bo.getId())) {
            return ResultUtil.failureResult("参数不正确!");
        }

        return ResultUtil.deleteResult(this.affixItemService.delete(bo.getId()));
    }

    /**
     * 获取附件列表
     */
    @PostMapping(value = "/queryList")
    public String queryList(@RequestBody AffixItemBO bo) {
        return ResultUtil.successResult(this.affixItemService.queryList(bo));
    }
}
